1582A - Luntik and Concerts - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

t=int(input())
for i in range(t):
    a=list(map(int,input().split()))
    x=a[0]
    y=a[1]
    z=a[2]
    ans=1
    if(((((x%2==0)and(y%2==0))and(z%2==0))or(((x%2==0)and(y%2==1))and(z%2==0)))or((((x%2==1)and(y%2==1))and(z%2==1))or(((x%2==1)and(y%2==0))and(z%2==1)))):
        ans=0
    print(ans)

C++ Code:

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <cmath>
using namespace std;

int main()
{

    int tc;
    cin >> tc;

    while (tc--)
    {
        int a, b, c;
        cin>>a>>b>>c;
        int total = a + b*2 + c*3;
        if(total%2 == 0)
        {   
            cout<<0<<endl;
        }
        else
        {
            cout<<1<<endl;
        }

    }
}

// 1 9 1

// 11, 11      2x+1  



// x 2y 3z   a-x  2b-2y   3c-3z

// 2x 4y 6z - a - 2b - 3c


// (x+2y+3z) = n/2


Comments

Submit
0 Comments
More Questions

1697C - awoo's Favorite Problem
165A - Supercentral Point
1493A - Anti-knapsack
1493B - Planet Lapituletti
747B - Mammoth's Genome Decoding
1591C - Minimize Distance
1182B - Plus from Picture
1674B - Dictionary
1426C - Increase and Copy
520C - DNA Alignment
767A - Snacktower
1365A - Matrix Game
714B - Filya and Homework
31A - Worms Evolution
1691A - Beat The Odds
433B - Kuriyama Mirai's Stones
892A - Greed
32A - Reconnaissance
1236D - Alice and the Doll
1207B - Square Filling
1676D - X-Sum
1679A - AvtoBus
1549A - Gregor and Cryptography
918C - The Monster
4B - Before an Exam
545B - Equidistant String
1244C - The Football Season
1696B - NIT Destroys the Universe
1674A - Number Transformation
1244E - Minimizing Difference